﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="corpusergrid.aspx.cs" Inherits="LTJ.WebPage.UserManage.user.corpusergrid"%>
<%@ Import Namespace="LTJ.Common"%>
<%@ Register TagPrefix="dyj" Namespace="LTJ.Control" Assembly="LTJ.Control" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>用户管理</title>
    <link href="../css/comm.css" type="text/css" rel="stylesheet" />
    <link href="../css/lightview.css" type="text/css" rel="stylesheet" />
    <script src="../js/jquery.js" type="text/javascript"></script>
    <script src="../js/prototype.js" type="text/javascript"></script>
    <script src="../js/scriptaculous.js?load=effects" type="text/javascript"></script>
    <script src="../js/lightview.js" type="text/javascript"></script>
    <script src="../js/effects.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="../js/common.js"></script>
    <script type="text/javascript">
        function Check(form, checked) {
            CheckByName(form, 'cid', checked);
            checkedEnabledButton(form, 'cid', 'pause', 'start', 'alldel', 'setadmin');
        }
        function formcheck() {
            if (event.keyCode == 13) {
                document.getElementById("check").focus();
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="adnr">
	    <div class="adnrt">
		    <p>会员名：<dyj:TextBox runat="server" ID="lname_txt" Width="100" MaxLength="10" onkeydown="formcheck()"></dyj:TextBox>&nbsp;</p>
            <p>姓名：<dyj:TextBox runat="server" ID="rname_txt" Width="100" MaxLength="10" onkeydown="formcheck()"></dyj:TextBox>&nbsp;</p>
            <p>电话：<dyj:TextBox runat="server" ID="phone_txt" Width="100" MaxLength="20" onkeydown="formcheck()"></dyj:TextBox>&nbsp;</p>
            <p>当前状态：
            <asp:RadioButtonList runat="server" ID="cur_status_txt" RepeatDirection="Horizontal" RepeatLayout="Flow">
                <asp:ListItem Selected="True" Text="正常" Value="1"></asp:ListItem>
                <asp:ListItem Text="禁用" Value="0"></asp:ListItem>
                <asp:ListItem Text="不限" Value="-1"></asp:ListItem>
            </asp:RadioButtonList>&nbsp;</p>
            <p><dyj:Button runat="server" ID="check" Text="查询" ButtonImgUrl="../images/search.gif"/></p>
	    </div>
	    <ul class="adnrt mar_top">
            <dyj:Button ID="add" runat="server" Text="新增" ButtonImgUrl="../images/add.gif" OnClientClick="return createrUser();"/>&nbsp;&nbsp;
		    <dyj:Button ID="pause" runat="server" Text="停用" ButtonImgUrl="../images/del.gif" Enabled="false"/>&nbsp;&nbsp;
            <dyj:Button ID="start" runat="server" Text="启用" Enabled="false"/>&nbsp;&nbsp;
            <dyj:Button ID="alldel" runat="server" Text="批量删除" ButtonImgUrl="../images/del.gif" Enabled="false"/>&nbsp;&nbsp;
            <dyj:Button ID="setadmin" runat="server" Text="设置管理员" ButtonImgUrl="../images/usergroup.gif" Enabled="false" Visible="false" OnClientClick="return setAdmins();"/>
	    </ul>
	    <div class="adnr3">
        <dyj:datagrid id="DataGrid1" runat="server" PageSize="10">
	       <Columns>
            <asp:TemplateColumn HeaderText="<input title='选中/取消' onclick='Check(this.form,this.checked)' type='checkbox' name='chkall' id='chkall' />">
                <HeaderStyle Width="20px" />
                <ItemTemplate>
                    <input id="cid" type="checkbox" onclick="checkedEnabledButton(form, 'cid', 'pause','start','alldel','setadmin')" value="<%# DataBinder.Eval(Container, "DataItem.id").ToString()%>" name="cid">
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="操作">
              <ItemTemplate>
                    <%if(manageType == 1 || manageType == 2){%><a class="l_blue lightview" rel="iframe" title="权限设置 :: :: width:600,height:700" href="../user/corpuserauthset.aspx?opmode=setmanager&cid=<%#DataBinder.Eval(Container, "DataItem.cid")%>&uid=<%#DataBinder.Eval(Container, "DataItem.id")%>">权限设置</a><%}%>
                    <%if(manageType == 2){%>&nbsp;&nbsp;<a class="l_blue lightview" rel="iframe" title="用户分配 :: :: width:600,height:700" href="../user/corpuserdist.aspx?aid=<%#DataBinder.Eval(Container, "DataItem.id")%>">用户分配</a><%}%>
                    <%if (OpAction(LTJ.Entity.OprateAction.Update)){%>&nbsp;&nbsp;<a class="l_blue lightview" rel="iframe" title=" :: :: width:600,height:480" href="../user/corpuseredit.aspx?opmode=edit&uid=<%#DataBinder.Eval(Container, "DataItem.id")%>">编辑</a><%}%>
                    <%if(manageType == 3 || companyinfo.Manager == userid){%>&nbsp;&nbsp;<a href="#" onclick="resetpass('<%# DataBinder.Eval(Container, "DataItem.id").ToString()%>')" class="l_blue">密码重置</a><%}%>
              </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="lname" HeaderText="会员名"></asp:BoundColumn>
            <asp:BoundColumn DataField="rname" HeaderText="姓名"></asp:BoundColumn>
            <asp:BoundColumn DataField="ename" HeaderText="英文名"></asp:BoundColumn>
            <asp:BoundColumn DataField="syspass" HeaderText="初始密码"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="性别">
              <ItemTemplate>
                    <%# DataBinder.Eval(Container, "DataItem.gender").ToString() == "True" ? "男" : "女"%>
              </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="phone" HeaderText="联系电话"></asp:BoundColumn>
            <asp:BoundColumn DataField="scores" HeaderText="积分"></asp:BoundColumn>
            <asp:BoundColumn DataField="createdate" HeaderText="创建时间"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="状态">
              <ItemTemplate>
                    <%# DataBinder.Eval(Container, "DataItem.status").ToString()=="1"?"正常":"停用"%>
              </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="flname" HeaderText="所属管理员" Visible="false"></asp:BoundColumn>
          </Columns>
	    </dyj:datagrid>
	    </div>
	    <i class="tp"></i><i class="bt"></i>
    </div>
    <button id="reclick" runat="server" style="display:none"></button>
    <input type="hidden" name="ruserid" />
    <input type="hidden" name="sadminid" />
    <button id="reuserpass" runat="server" style="display:none"></button>
    <button id="setadminclick" runat="server" style="display:none"></button>
    </form>
</body>
<script type="text/javascript">
    function createrUser() {
        Lightview.show({ href: '../user/corpuseredit.aspx?opmode=add&gid=<%=groupid%>', rel: 'iframe', options: { width: 600, height: 480} }); return;
    }

    function setAdmins() {
        Lightview.show({ href: '../user/seladmin.aspx', rel: 'iframe', options: { width: 600, height: 480} }); return;
    }

    function resetpass(uid) {
        if (confirm("您确定要重置该用户密码为初识密码？")) {
            form1.ruserid.value = uid;
            document.getElementById("reuserpass").click();
        }
    }
</script>
</html>